<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    function Cat(name, color) {
        this.name = name;
        this.color = color;
    }

    // ES5 
    // 自定义静态属性和方法  => 构造函数自己使用 (函数也是一个特殊的对象)
    Cat.x = 1;
    Cat.y = 2;
    Cat.sum = function(){  // Cat.sum()
        // console.log(this);
        return this.x + this.y;
    }
    Cat.isCat = function(arg){
        if(arg.constructor === Cat){
            return true;
        }
        return false;
    }


    Cat.prototype.species = "Cat";
    Cat.prototype.skill = function () {
        console.log("捉老鼠");
    }
    Cat.prototype.call = function () {
        console.log("喵喵");
    }
    Cat.prototype.say = function () {
        console.log(this.name, this.color);
    }

    console.dir(Cat)

    // var Tom = new Cat("Tom","black");
    // console.log(Tom);


    console.log(Cat.x);
    console.log(Cat.y);
    console.log(Cat.sum());


</script>

</html>